package com.fjp.heartguard.viewmodel

import androidx.databinding.ObservableField
import androidx.lifecycle.MutableLiveData
import com.fjp.heartguard.app.App
import com.fjp.heartguard.app.data.bean.AppVersion
import com.fjp.heartguard.app.data.bean.QuestionnatireCount
import com.fjp.heartguard.app.data.bean.UserInfo
import com.fjp.heartguard.app.network.HttpRequestCoroutine
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request
import me.hgj.jetpackmvvm.state.ResultState

class MineViewModel : BaseViewModel() {
    var appVersion = MutableLiveData<ResultState<AppVersion>>()
    var questionnatireCount = MutableLiveData<ResultState<QuestionnatireCount>>()
    var userInfo = ObservableField<UserInfo>(App.userInfo)
    fun checkVersion() {
        request({
            HttpRequestCoroutine.checkVersion()
        }, appVersion, false)

    }

    fun getQuestionnaireCount() {
        request({
            HttpRequestCoroutine.getQuestionnaireCount()
        }, questionnatireCount, false)

    }

}